package org.esky;

/**
 * 编程：写一个函数，判断一个32位的整数是否是2的N次方
 */
public class T11 {
	public static void main(String[] args) {
		System.out.println(check(32, 2));
	}
	
	public static boolean check(int i, int n) {
		int num = 1;
		while (true) {
			if (num > i) {
				return false;
			}
			if (num == i) {
				return true;
			}
			num = num * n;
		}
	}
}
